import pandas as pd

def compute_scale_risk(data_path, annual_credit):
    df_in = pd.read_excel(data_path, sheet_name='进项发票信息')
    df_out = pd.read_excel(data_path, sheet_name='销项发票信息')
    df_in['总额'] = df_in['价税合计']
    df_out['总额'] = df_out['价税合计']
    in_sum = df_in.groupby('企业代号')['总额'].sum()
    out_sum = df_out.groupby('企业代号')['总额'].sum()
    scale_df = pd.DataFrame({'企业代号': in_sum.index.union(out_sum.index)})
    scale_df['inflow'] = scale_df['企业代号'].map(in_sum).fillna(0)
    scale_df['outflow'] = scale_df['企业代号'].map(out_sum).fillna(0)
    scale_df['交易总额'] = scale_df['inflow'] + scale_df['outflow']
    scale_df['scale_risk'] = annual_credit / scale_df['交易总额'].replace(0, pd.NA)
    valid = scale_df['scale_risk'].dropna()
    min_r, max_r = valid.min(), valid.max()
    scale_df['scale_risk_norm'] = (scale_df['scale_risk'] - min_r) / (max_r - min_r)
    return scale_df[['企业代号', 'scale_risk_norm']]